#include "pch.h"
#include "ExecFilterPipe.h"

using namespace AutomatedSurfaceReconstruction;

CExecFilterPipe::CExecFilterPipe(QObject* vParent) : QObject(vParent)
{

}

void CExecFilterPipe::execFilterPipe(std::unordered_map<std::string, std::pair<CGALPointSetType, CGALPointSetType>> vPointCloud2RoadData)
{
	for (auto Iter : vPointCloud2RoadData) 
	{ 
		auto TempPair = std::make_pair(std::make_pair(Iter.first, Iter.second.first), Iter.second.second);
		m_System.pushData2FilePool(TempPair);
	}
	std::string OutputMeshPath = m_System.setMaxUsedThread();
	emit ReconstructOneMesh(OutputMeshPath);
	m_System.organizeExternalInputBuffer();
	for (int i = 0; i < vPointCloud2RoadData.size() - 1; i++)
	{
		OutputMeshPath = m_System.getFinishedThreadOutputPath();
		emit ReconstructOneMesh(OutputMeshPath);
	}
	emit resultReady();
}